﻿@inherits AutoCompleteModel<Entity.Role>
@inject IAdminStore<Entity.Role> _store

@if (IsReadOnly)
{
    <div class="input-group input-group-sm mb-3">
        <a class="form-control @FieldClass" href="/role/@Entity.Id">@Entity.Name</a>
        <div class="input-group-append select" @onclick="() => DeleteClicked.InvokeAsync(null)">
            <span class="input-group-text oi oi-trash" />
        </div>
    </div>
}
else
{
    <div id="@Id" @key="@Entity" class="input-group input-group-sm mb-3" data-bs-toggle="dropdown">
        <input type="text" class="form-control new-claim" placeholder="@Localizer["role"]" value="@CurrentValue"
               @oninput="OnInputChanged" @onfocus="Filter"/>
        <div class="input-group-append" @onclick="() => SetSelectedValue(CurrentValue)">
            <span class="input-group-text oi oi-plus" />
        </div>
    </div>
    <div class="dropdown-menu m-0">
        @if (FilteredValues != null)
        {
            foreach (var value in FilteredValues)
            {
                <button class="dropdown-item m-0 p-0 pl-1 pr-1" type="button" @onclick="() => SetSelectedValue(value)">
                    <small>@value</small>
                </button>
            }
        }
    </div>
}
